# -*- coding: UTF-8 -*-
"""
获取当前主机的公网IP地址
"""
import requests
import re


def GetCurrentIP():
    resp = requests.get('https://ip.tool.lu/').content
    resp = resp.decode('utf8')
    ip_match = str('\d+.\d+.\d+.\d+')
    match_obj = re.search(ip_match, resp)
    return match_obj.group()


def Get_address():
    """
    获取当前主机所在网络的公网地址
    :return:
    """
    ip = GetCurrentIP()
    if ip:
        return ip
    return False
